#include <iostream>

class Home;

class GoodFriend
{

public:
    Home *home;
    void visit_home();
};

class Home
{

    friend class GoodFriend;

public:
    std::string living_room = "客厅";

private:
    std::string bedroom = "卧室";
};

void GoodFriend::visit_home() // 要访问home中的完整属性还是需要将home完整定义放在前面，我想这也就是为什么要将类的声明写在头文件，然后在代码的最前面引用吧
{
    std::cout << home->living_room << std::endl;
    std::cout << home->bedroom << std::endl;
}

int main(int argc, char const *argv[])
{
    

    Home *home = new Home;

    GoodFriend *goodFriend = new GoodFriend;

    goodFriend->home = home;
    goodFriend->visit_home();

    return 0;
}
